/**
 * Copyright 2023 Inc.
 **/
package com.myz.transaction.propotation.web;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.myz.transaction.propotation.dao.UserRepositoryA;
import com.myz.transaction.propotation.service.impl.nested.ServiceNested;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author maoyz0621 on 2023/11/7
 * @version v1.0
 */
@RestController
public class UserController {

    @Autowired
    private ServiceNested serviceNested;

    @Autowired
    private UserRepositoryA userRepositoryA;

    @Autowired
    ObjectMapper objectMapper;

    @RequestMapping("/a")
    public void notransaction_exception_nested_nested() {
        serviceNested.notransaction_exception_nested_nested();
    }

    @RequestMapping("/get")
    public String get() throws JsonProcessingException {
        return objectMapper.writeValueAsString(userRepositoryA.getOne(1L));
    }

}